From: Jonas Dreßler Date: Thu, 12 Mar 2020 12:37:53 +0000 (+0100) Subject: altTab: Set allocation before allocating children X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~684^2^2~451 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=49d6db34b74752dc11dfff7a51ad4f6ebf8cdf57;p=gnome-shell.git altTab: Set allocation before allocating children Just as with the last commit, we should not break the assumption made by Clutter that parents have their allocation set before their children get allocated, so fix that here, too. In this case we have to fix it by chaining up to the parent vfunc override and updating the allocation once more before allocating the `this._label` child. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1615 --- diff --git a/js/ui/altTab.js b/js/ui/altTab.js index 94b80f792..1c35a001e 100644 --- a/js/ui/altTab.js +++ b/js/ui/altTab.js @@ -1060,25 +1060,25 @@ class WindowSwitcher extends SwitcherPopup.SwitcherList { vfunc_allocate(box, flags) { let themeNode = this.get_theme_node(); let contentBox = themeNode.get_content_box(box); + const labelHeight = this._label.height; + const totalLabelHeight = + labelHeight + themeNode.get_padding(St.Side.BOTTOM); - let childBox = new Clutter.ActorBox(); - childBox.x1 = contentBox.x1; - childBox.x2 = contentBox.x2; - childBox.y2 = contentBox.y2; - childBox.y1 = childBox.y2 - this._label.height; - this._label.allocate(childBox, flags); - - let totalLabelHeight = this._label.height + themeNode.get_padding(St.Side.BOTTOM); - childBox.x1 = box.x1; - childBox.x2 = box.x2; - childBox.y1 = box.y1; - childBox.y2 = box.y2 - totalLabelHeight; - super.vfunc_allocate(childBox, flags); + box.y2 -= totalLabelHeight; + super.vfunc_allocate(box, flags); // Hooking up the parent vfunc will call this.set_allocation() with // the height without the label height, so call it again with the // correct size here. + box.y2 += totalLabelHeight; this.set_allocation(box, flags); + + const childBox = new Clutter.ActorBox(); + childBox.x1 = contentBox.x1; + childBox.x2 = contentBox.x2; + childBox.y2 = contentBox.y2; + childBox.y1 = childBox.y2 - labelHeight; + this._label.allocate(childBox, flags); } highlight(index, justOutline) {